import request from '@/utils/request'

// 查询保养配置列表
export function listMaintenanceConfig(query) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/list',
    method: 'get',
    params: query
  })
}

// 查询保养配置详细
export function getMaintenanceConfig(id) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/' + id,
    method: 'get'
  })
}

// 新增保养配置
export function addMaintenanceConfig(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config',
    method: 'post',
    data: data
  })
}

// 修改保养配置
export function updateMaintenanceConfig(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config',
    method: 'put',
    data: data
  })
}

// 删除保养配置
export function delMaintenanceConfig(id) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/' + id,
    method: 'delete'
  })
}

// 修改保养配置状态
export function updateMaintenanceConfigStatus(configId, status) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/changeStatus',
    method: 'put',
    data: {
      configId,
      configStatus: status
    }
  })
}

// 获取设备类型列表
export function getEquipmentTypeList() {
  return request({
    url: '/ldzl-sb/sb/equipment/type/list',
    method: 'get'
  })
} 

// 校验保养配置编号是否唯一
export function checkConfigCodeUnique(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/checkConfigCodeUnique',
    method: 'post',
    data: data
  })
}

// 生成保养配置编码
export function generateConfigCode() {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/generateConfigCode',
    method: 'get'
  })
}

// 根据设备类型获取保养配置
export function getConfigsByTypeId(typeId) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/type/' + typeId,
    method: 'get'
  })
}

// 根据配置编码获取保养配置信息
export function getConfigByCode(configCode) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/getByCode/' + configCode,
    method: 'get'
  })
}

// 导出保养配置
export function exportMaintenanceConfig(query) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/export',
    method: 'get',
    params: query
  })
}

// 获取导入模板
export function importTemplate() {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/importTemplate',
    method: 'get'
  })
}

// 导入数据
export function importData(data) {
  return request({
    url: '/ldzl-sb/sb/maintenance/config/importData',
    method: 'post',
    data: data
  })
} 